import {UserIdentifier,EntityIdentifier,UniqueIdentifier,Record,VersionedRecord,ByteArray,EnumField}  from './store'

export {
  UserIdentifier,
  EntityIdentifier,
  Record,
  VersionedRecord,
  ByteArray,
  EnumField
}

export interface AuditableRecord extends Record {
  
  createTime: Date
  creatorId: UserIdentifier
  updateTime: Date
  modifierId: UserIdentifier
}


export interface Dealer {
  id: UserIdentifier
  name: string
}
export interface GraphRecord extends AuditableRecord {
  uniqueCode: string
  name: string
  description: string
  content: ByteArray
}

export interface RequestRecord  extends Record {
  dealerId: UserIdentifier
  dealerName: string
  requestTime: Date
  overTime: Date
  activityId?: EntityIdentifier
  graphId?: EntityIdentifier
  graphUniqueCode?: string
  input?: ByteArray
  result?: ByteArray
}

export interface StateRecord  extends Record  {
  input?: ByteArray
  variable: ByteArray
  output?: ByteArray
  error?: ByteArray
}

export interface StatusRecord  extends Record {
  activityStatus: EnumField
  executeStatus: EnumField
}
  

export interface NodeRecord  extends Record {
  graphId: EntityIdentifier
  name: string
  path: string
  parentId?: EntityIdentifier
  flowId: EntityIdentifier
}

export interface LockRecord  extends Record  {
  requestId?: UniqueIdentifier
  dealerId?: UserIdentifier
  lockTime?: Date
  lockExpiryTime?: Date
}



export interface ExecutionRecord 
extends StatusRecord,StateRecord,NodeRecord,LockRecord {
  originalActivityStatus: EnumField
  activityId: EntityIdentifier
  startTime?: Date
  updateTime?: Date
  overTime?: Date
}

export interface ExecutiveRecord extends StatusRecord,StateRecord,NodeRecord,LockRecord,AuditableRecord {
  owner?: string
  executionId: EntityIdentifier
  //#region times
 enterTime?: Date
 suspendTime?:Date 
 dealTime?: Date
 doneTime?: Date
 exitTime?: Date
 completeTime?: Date
 //#endregion
}


export interface ActivityRecord extends ExecutiveRecord,VersionedRecord { 
  
  //#region route to next / or from previous
  fromActivityId?: EntityIdentifier
  navigationName?: string
  toActivityIds: string

 

  //#region lock
  
  //#endregion

  
}



